import {TableConfig} from "vj-tool/vj-tool/types";
import {genFormOptions, genTbFmt} from "vijay-util";
import {TBFmt} from "@/config/formatter";

export const PuzzleRecordTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "name", label: "活动类型"},
    {propName: "name", label: "活动标题"},
    {propName: "name", label: "活动状态"},
    {propName: "name", label: "创建时间"},
    {propName: "name", label: "活动开始时间"},
    {propName: "name", label: "活动结束时间"},
    {propName: "name", label: "人数"},
    {propName: "name", label: "分享链接"},
    {propName: "name", label: "分享二维码"},
    {propName: "name", label: "签到二维码"},
];
export const PolicyTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "title", label: "标题"},
    {propName: "city", label: "政治等级", formatter: TBFmt.addrFmt},
    {propName: "createuser", label: "发布者"},
    {propName: "readno", label: "阅读量"},
    {propName: "weight", label: "排序权重"},
    {propName: "status", label: "状态", formatter: genTbFmt(["上架", "已下架"], -1)},
    {propName: "createTime", label: "创建时间"},
];
export const UserTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "phone", label: "手机号"},
    {propName: "realname", label: "姓名"},
    {propName: "userType", label: "类型", formatter: genTbFmt(["后端", "前端", "企业"], -1)},
    {propName: "roleType", label: "角色", formatter: genTbFmt(["普通用户", "导师"], -1)},
    {propName: "name", label: "所属地区", formatter: TBFmt.addrFmtCode},
    {propName: "status", label: "状态", formatter: genTbFmt(["正常", "冻结"], -1)},
];
export const CompanyTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "name", label: "企业全称"},
    {propName: "trade", label: "所属行业"},
    {propName: "", label: "所属地区", formatter: TBFmt.addrFmt},
    {propName: "postssum", label: "岗位数"},
    {propName: "createTime", label: "通过时间"},
];
export const CompanyDeliveryTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "name", label: "姓名"},
    {propName: "phone", label: "手机号"},
    {propName: "grade", label: "年龄"},
    {propName: "school", label: "学校"},
    {propName: "specialty", label: "专业"},
    {propName: "createTime", label: "提交时间"},
];
export const CompanyJobTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "typeid", label: "岗位种类", formatter: genTbFmt([])},
    {propName: "postsname", label: "岗位名称"},
    {propName: "createTime", label: "发布时间"},
    {propName: "status", label: "状态", formatter: genTbFmt(["上架", "下架"], -1)},
    {propName: "deliverno", label: "投递数量"},
];
export const JobsTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "id", label: "排序"},
    {propName: "postsname", label: "岗位名称"},
    {propName: "createTime", label: "发布时间"},
    {propName: "status", label: "状态", cmp: "switch"},
    {propName: "name", label: "投递数量"},
    {propName: "name", label: "岗位分类"},
];
export const DeliveryTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "id", label: "姓名"},
    {propName: "postsname", label: "手机号"},
    {propName: "createTime", label: "年龄"},
    {propName: "createTime", label: "学校"},
    {propName: "createTime", label: "专业"},
    {propName: "createTime", label: "提交时间"},
    {propName: "name", label: "岗位分类"},
];
export const RoleTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "roleName", label: "角色名称"},
    {propName: "createTime", label: "创建时间"},
];
export const PictureTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "type", label: "分类"},
    {propName: "url", label: "图片", cmp: "img"},
    {propName: "imgname", label: "图片名称"},
    {propName: "createTime", label: "添加时间"},
];
export const NewsTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "title", label: "新闻标题"},
    {propName: "subtitle", label: "副标题"},
    {propName: "img", label: "新闻图片", cmp: "img"},
    {propName: "createTime", label: "添加时间"},
];
export const BannerTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "type", label: "所属板块", formatter: genTbFmt(["首页", "赛事培训"], -1)},
    {propName: "url", label: "图片", cmp: "img"},
    {propName: "sorting", label: "排序"},
];
export const CompanyFairTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "name", label: "招聘会名称"},
    {propName: "id", label: "参与企业"},
    {propName: "url", label: "链接"},
    {propName: "picture", label: "封面图", cmp: "img"},
    {propName: "sorting", label: "排序"},
    {propName: "status", label: "状态", cmp: "switch"},
    {propName: "createTime", label: "通过时间"},
];
export const MemberQcpTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "id", label: "青创派编号"},
    {propName: "groupname", label: "姓名"},
    {propName: "phone", label: "电话号码"},
    {propName: "profession", label: "职务"},
    {propName: "company", label: "公司"},
    {propName: "projectname", label: "项目名称"},
];
export const MemberTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "realname", label: "姓名"},
    {propName: "phone", label: "手机号"},
    {propName: "entrepreneur", label: "创业阶段", formatter: genTbFmt(["暂无", "种子", "天使", "Pre-A", "A轮", "A轮以上6尚未融资"])},
    {propName: "roleType", label: "角色", formatter: genTbFmt(["普通用户", "导师"], -1)},
    {propName: "createTime", label: "注册时间"},
    {propName: "status", label: "状态", formatter: genTbFmt(["正常", "冻结"], -1)},
];
export const JobTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "name", label: "岗位种类"},
    {propName: "status", label: "状态", formatter: genTbFmt(["上架", "下架"], -1)},
];
export const TeacherCategoryTB: TableConfig = [
    {propName: "id", label: "序号"},
    {propName: "name", label: "分类名称"},
    {propName: "name", label: "状态"},
];
export const FeqTB: TableConfig = [
    {propName: "id", label: "序号"},
    {propName: "sort", label: "问题分类"},
    {propName: "mistitle", label: "问题标题"},
    {propName: "name", label: "发布人"},
    {propName: "phone", label: "手机号"},
    {propName: "replyno", label: "回答数"},
    {propName: "status", label: "状态", formatter: genTbFmt(["拒绝", "同意"], -1)},
    {propName: "createTime", label: "发布时间"},
];
export const TeacherTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "name", label: "姓名"},
    {propName: "name", label: "手机号"},
    {propName: "name", label: "公司"},
    {propName: "name", label: "职位"},
    {propName: "name", label: "创建时间"},
];
export const MerchantTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "name", label: "名称"},
    {propName: "name", label: "地址"},
    {propName: "name", label: "产业范围"},
    {propName: "name", label: "联系方式"},
    {propName: "name", label: "状态"},
    {propName: "name", label: "创建时间"},
];
export const TalentTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "typeid", label: "岗位种类", formatter: genTbFmt([])},
    {propName: "name", label: "公司名称"},
    {propName: "postsname", label: "岗位名称"},
    {propName: "createTime", label: "发布时间"},
    {propName: "status", label: "状态", formatter: genTbFmt(["上架", "下架"], -1)},
    {propName: "name", label: "投递数量"},
    {propName: "name", label: "排序"},
];
export const CapitalBPTB: TableConfig = [
    {propName: "id", label: "序号"},
    {propName: "title", label: "项目名称"},
    {propName: "createBy", label: "创始人姓名"},
    {propName: "phone", label: "联系方式"},
    {propName: "delivertime", label: "投递时间"},
    {propName: "annex", label: "附件"},
];
export const CapitalTB: TableConfig = [
    {propName: "id", label: "编号"},
    {propName: "title", label: "标题"},
    {propName: "tag", label: "标签"},
    {propName: ["mininvest", "maxinvest"], label: "投资区间", cmp: "range"},
    {propName: "createTime", label: "发布时间"},
    {propName: "createBy", label: "创建人"},
    {propName: "status", label: "状态", formatter: genTbFmt(["上架", "下架"], -1)},
]
export const ActivitiesTB: TableConfig = [
    {propName: "id", label: "ID"},
    {propName: "type", label: "活动类型", formatter: genTbFmt(["创业大赛", "创业活动"])},
    {propName: "title", label: "活动标题"},
    {propName: "name", label: "活动状态"},
    {propName: "createTime", label: "创建时间"},
    {propName: "actstarttime", label: "活动开始时间"},
    {propName: "actendtime", label: "活动结束时间"},
    {propName: "limitpeople", label: "人数"},
    {propName: "acturl", label: "分享链接"},
    {propName: "name", label: "分享二维码"},
    {propName: "name", label: "签到二维码"},
];
export const ActivityFormTB: TableConfig = [
    {propName: "ismust", label: "必填", cmp: "switch"},
    {
        propName: "type",
        label: "类型",
        cmp: "select",
        config: genFormOptions(["单行文本", "图片", "多行文本", "下拉菜单", "多选", "单选"], 1)
    },
    {propName: "name", label: "字段名", cmp: "input"},
    {propName: "prompt", label: "输入提示", cmp: "input"},
];
export const ActivityApplyTB: TableConfig = [
    {propName: "id", label: "报名id"},
    {propName: "name", label: "报名姓名"},
    {propName: "name", label: "报名电话"},
    {propName: "name", label: "附件"},
    {propName: "name", label: "报名状态"},
];
export function dynamicTable(arr: TableConfig): TableConfig {
    return <any[]>arr.reduce((acc, cur) => {
        const notAllow = Array.isArray(cur) && cur[1] !== cur[2];
        Array.isArray(cur) && (cur = cur[0]);
        return notAllow ? acc : (<any[]>acc).concat(cur)
    }, [])
}
export type TableFunc = (...args) => TableConfig;
